package com.zzc.study.service;


import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;

import java.util.Map;

// @Service + @Tool
@Service
public class WeatherService {

	@Tool(description = "根据城市名称获取天气预报")
	public String getWeatherByCity(String city)
	{
		Map<String, String> map = Map.of(
				"北京", "降雨频繁，其中今天和后天雨势较强，部分地区有暴雨，并伴强对流天气，需注意防范",
				"上海", "多云,15℃~27℃,南风3级，当前温度27℃。",
				"深圳", "多云40天，阴16天，雨30天，晴3天"
		);
		return map.getOrDefault(city, "抱歉：未查询到对应城市！");
	}

}